/*
 * rom.h
 *
 * Created: 8/21/2013 2:36:16 PM
 *  Author: Ken Arok
 *
 * \brief Read Only Memory (EEPROM or Flash ROM) Driver.
 *
 * Copyright (c) 2013 PT Hanindo Automation Solutions. All rights reserved.
 *
 */

/** \section section_rom_driver ROM/EEPROM Driver
 * \brief This module describes how to user API library of the ROM/EEPROM.
 */


#ifndef ROM_H_
#define ROM_H_

#include <stdint.h>

/*! \defgroup ROM_DRIVERS The Driver of ROM/EEPROM
 * \{
 */

/** \brief Read data byte from ROM Device.
 * <pre><rom.h></pre>
 * <pre>\b char \b vReadROM(uint32_t _start_addr, void *_pbuf, uint32_t _len);</pre>
 *
 * @param _start_addr	Start address in the memory want to be read.
 * @param _pbuf			Pointer to the buffer where data will be copied.
 * @param _len			Number of byte data want to be read.
 *
 * @return Status
 *	@retval	0	Success.
 *	@retval	-1	Failed.
 *
 */
extern char vReadROM(uint32_t _start_addr, void *_pbuf, uint32_t _len);

/** \brief Write data to ROM Device.
 * <pre><rom.h></pre>
 * <pre>\b char \b vWriteROM(uint32_t _star_addr, const void *_pbuf, uint32_t _len);</pre>
 *
 * @param _star_addr	Start of address to be programmed.
 * @param _pbuf			Pointer to the data want to be programmed.
 * @param _len			Number of bytes of data want to be programmed.
 *
 * @return Status
 *	@retval 0	Success.
 *	@retval	-1	Failed.
 *
 */
extern char vWriteROM(uint32_t _star_addr, const void *_pbuf, uint32_t _len);

/** \brief Erase block memory on ROM Device.
 * <pre><rom.h></pre>
 * <pre>\b void \b vEraseROM(uint32_t _block_addr);</pre>
 *
 * @param _block_addr	Block address want to be erased.
 *
 */
extern void vEraseROM(uint32_t _block_addr);

/**
 * \}
 */

#endif /* ROM_H_ */
